<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<%-- <s:head /> --%>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/business/trail.js"></script>

<script type="text/javascript">
    // 	<s:iterator value="containers" status="st">
    // 		<s:if test="#st.first">containers=[</s:if>
    // 		{id:"<s:property value='id'/>",
    // 			size:"<s:property value='ct_size'/>",
    // 			type:"<s:property value='ct_type'/>",
    // 			index:"<s:property value='#st.index+1'/>" }
    // 		<s:if test="#st.last">]
    // 		</s:if><s:else>,</s:else>
    // 	</s:iterator>
    // 	var trai_tds=$("#tril_goodsList tr:gt(0)").find("td:eq(7)");
    // 	$.each(trai_tds,function(i,n){
    // 		var idsStr=$(n).text();
    // 		var str="";
    // 		if(idsStr){
    // 			var ids=idsStr.split(",");
    // 			$.each(ids,function(k,p){
    // 				$.each(containers,function(j,m){
    // 					if(m.id==p){
    // 						str+=m.index+"号柜-"+m.size+"'"+m.type;
    // 						if(k!=ids.length-1){
    // 							str+=",";
    // 						}
    // 					}
    // 				});
    // 			});
    // 		}
    // // 		$(n).text(str);
    // 	});
    // 	initCtNumTypeDropdown(containers);
    $(document).ready(function () {
        setCt_num();
        containers = Gd_ctNumTypeMsg();
        initCtNumTypeDropdown(containers);
        countTotalSizeType();
        var trailId = $("#trailId").val();
        if (trailId == null || trailId == "") {
            //装运信息
            $("#trial_info_show").hide();
            //保存按钮
            $("#orderSave").hide();
            $("#confirmgoodesadBtn").hide();
            //货物信息
            $("#tril_goodsList_title").hide();
            $("#tril_goodsList").hide();
            //so文件上传
            $("#so").hide();

        } else {
            $("#trial_info_show").show();
            $("#trail_info_shipmen").hide();
            $("#confirmgoodesadBtn").show(); //装运信息确认按钮
            $("#tril_goodsList_title").show();
            $("#tril_goodsList").show();
            $("#so").show();//so文件上传
            //修改页面隐藏柜型柜量
// 			$("#containersInfo").hide();
// 			$("#trailContainersInfo").hide();
// 			$("#confirmContainerNum").hide();

// 				showTrailInfo();//进入修改页面时进行确认柜量
            if ($("#commonTemplateId").val() == "1") {
                $("#tril_goodsList tr:gt(0)").find("td:eq(9)").each(function (i, n) {
                    $(n).text("");
                });
                $("#tril_goodsList tr:gt(0)").find("td:eq(8)").each(function (i, n) {
                    $(n).text("");
                });
            }

        }

    });

    function setCt_num() {
        var sizeType = new Array();
        var modelTypeInfo = $("#modelTypeInfo").val();
        if (modelTypeInfo == "1") {
            var number = $("#trial_gd_input tr:gt(4)").length;
            if (number < 1) {
                return;
            }
            var strTemp = "";
            for (; number >= 1; number--) {
                strTemp += $("#trial_gd_input tr:gt(4)").eq(number - 1).find(
                        "td").eq(7).text();
                strTemp += ",";
            }
        } else {
            var number = $("#tril_goodsList").find("tr").length;
            if (number <= 1) {
                return;
            }
            var strTemp = "";
            for (; number > 1; number--) {
                strTemp += $("#tril_goodsList").find("tr").eq(number - 1).find(
                        "td").eq(8).text();
                strTemp += ",";
            }
        }

        strTemp = strTemp.substring(0, strTemp.length - 1);
        sizeType = strTemp.split(",");
        //去重
        var tempArray = [];
        var tempObj = {};
        for (var i = 0; i < sizeType.length; i++) {
            if (!tempObj[sizeType[i]]) {
                tempArray.push(sizeType[i]);
                tempObj[sizeType[i]] = 1;
            }
        }
        sizeType = tempArray;
        //计算相同柜的总数
        tempArray = [];
        var str = sizeType.join("-");
        sizeType = [];
        tempArray = str.split("-");
        for (var i = 0; i < tempArray.length; i += 2) {
            sizeType.push(tempArray[i + 1]);
        }
        sizeType.sort();
        var results = new Array();

        for (var i = 0; i < sizeType.length;) {
            var n = 1;
            var number = 1;
            for (var j = i + 1; j < sizeType.length; j++) {
                if (sizeType[i] == sizeType[j]) {
                    number += 1;
                    n++;
                }
            }
            results.push(number + "'" + sizeType[i]);
            i = i + n;
        }

        for (var i = 0; i < results.length; i++) {
            var result = results[i];
            var num = result.split("'")[0];
            var size = result.split("'")[1];
            var type = result.split("'")[2];
            if (i != 0) {
                addCtTrailType();
                //alert($("#tabs").height());
            }
            $(".ct_num").eq(i).val(num);
            $(".ct_size").eq(i).val(size);
            $(".ct_type").eq(i).val(type);
        }
    }

    var code = "44";
    var code2 = "";
    var code3 = "";
    var code4 = "";

    function dropdown(obj, layer) {
        $(obj)
                .autocomplete(
                        {
                            source: function (request, response) {
                                $
                                        .ajax({
                                            url: "../base/address-dropdown?layer="
                                            + layer + "&code=" + code,
                                            dataType: "json",
                                            type: "post",
                                            data: {
                                                keyword: request.term
                                            },
                                            success: function (data) {
                                                response($
                                                        .map(
                                                                data.addresses,
                                                                function (item) {
                                                                    return {
                                                                        code: item.code,
                                                                        value: item.name,
                                                                        label: item.name
                                                                        + (item.parentName
                                                                        && item.parentName != "" ? "--"
                                                                        + item.parentName
                                                                                : ""),
                                                                        layer: item.layer,
                                                                        parentName: item.parentName
                                                                    };
                                                                }));
                                            }
                                        });
                            },
                            minLength: 0,
                            select: function (event, ui) {
                                //$("#address_city").val(ui.item.code);
                                if (layer == "2") {
                                    code2 = ui.item.code;
                                } else if (layer == "3") {
                                    code3 = ui.item.code;
                                    var parentName = ui.item.parentName;
                                    if (parentName) {
                                        $(obj).prev().val(parentName);
                                    }
                                } else if (layer == "4") {
                                    code4 = ui.item.code;
                                    var parentName = ui.item.parentName;
                                    if (parentName) {
                                        $(obj).prev().val(
                                                parentName.split(",")[0]);
                                        $(obj).prev().prev().val(
                                                parentName.split(",")[1]);
                                    }
                                }
                                code = ui.item.code;
                            },
                            search: function (event, ui) {
                                if (layer == "2") {
                                    code = "44";
                                } else if (layer == "3") {
                                    code = code2;
                                } else if (layer == "4") {
                                    code = code3;
                                }
                            }
                        });
        $(obj).bind("click", function () {
            /* $(this).val("");
             if(layer=="3"&&code2==""){
             $(this).prevAll().val("");
             }else if(layer=="4"&&(code3==""||code2=="")){
             $(this).prevAll().val("");
             }
             if(layer=="2"){
             code = "44";
             }else if(layer=="3"){
             code = code2;
             }else if(layer=="4"){
             code = code3;
             } */
            $(this).autocomplete('search', '');
        });
    }

    // 	$("#gd_zhTime").bind({
    // 		mouseover:function(){alert(2);},
    // 		mouseout:function(){
    // 			var gd_zhTime = $("#gd_zhTime").val();
    // 			alert(gd_zhTime);
    // 		}
    // 	});
</script>
<style>
    .clean {
        clear: both
    }

    #containers .li1 input {
        width: 30px;
    }

    .custom_ipw {
        width: 40px;
    }

    .add_line {
        border: 1px solid #b9b9b9;
        padding: 2px 0;
    }

    .custom_cl, .custom_fl {
        float: left;
    }

    .clear {
        clear: both;
    }

    .custom_wd {
        widht: 100%;
    }

    .trail_dataTB_Individual {
        border: 1px solid #b9b9b9;
    }

    .trail_titleTD {
        border-right: 1px solid #b9b9b9;
        border-bottom: 1px solid #b9b9b9;
    }

    .custom_bl {
        border-right: 1px solid #b9b9b9;
        border-bottom: 1px solid #b9b9b9;
        padding: 5px 0;
    }

    .ui-widget-header {
        border: none;
        border-bottom: 1px solid #65B1BB
    }

    .ui-widget-content {
        border: 1px solid #AAE0E7;
    }

    #tril_goodsList_title {
        margin-top: 20px;
    }

    .dataTB_Individual {
        margin: 10px 0 0 0;
    }

    .trail_dataTB_Individual {
        width: 100%;
    }

    /* #trial_gd_input{margin-top:15px;width:100%;} */
    .textInput, .custom_ipt {
        border-radius: 2px;
        border: 1px solid #ccc;
    }

    input.ui-button {
        padding: 0.2em 0.6em;
    }

    .ui-state-default:hover {
        background: none;
    }

    .custom_wbf { /* width:80%; */
        margin-left: 5px;
        margin-right: 5px;
    }

    .custom_sw {
        font-size: 12px;
        font-weight: bold;
        text-align: center;
        color: #2779aa;
    }

    .ul1 {
        margin: 15px;
    }

    .module {
        border-top: 1px solid #DADADA;
        padding: 10px 0;
        margin: 0 15px;
    }

    .list_title {
        font-weight: bold;
    }
</style>
<div class="page_font">
    <div>
        <input value="${trial.id }" type="hidden" name="trial.id" id="trailId"/>
        <%-- 	<input value="<s:date name="zhDate" format="yyyy-MM-dd HH:mm" />" type="text" id="trailCommonTemplate"/> --%>
        <input value="${trial.commonTemplate }" type="hidden" id="commonTemplateId"/>
        <input type="hidden" id="modelTypeInfo" value="${modelType }"/>
        <s:if test="modelType=='1'.toString()">
            <ul class="ul1">
                <li class="li1 first_li">拖车业务代理人：</li>
                <li class="li1"><input class="custom_ipt" type="text" id="trial_sup_id"
                                       name="trial.supCompany.name" value="${trailModel.supCompany.name }"/><input
                        type="hidden" id="trial_sup" name="trial.supCompany.id"
                        value="${trailModel.supCompany.id }"/></li>
                <li class="li1 first_li" style="margin-left:10px;">PI号：</li>
                <li class="li1"><input class="custom_ipt"
                                       type="text" id="trial_pi" name="trial.pi"
                                       value="${trailModel.pi }" onblur="javascript:getPi(this.value);"/></li>
                <li class="li1 first_li" style="margin-left:10px;">报关票数登记：</li>
                <li class="li1"><input class="custom_ipt"
                                       type="text" id="trial_declarationCount" name="trial.declarationCount"
                                       value="${trailModel.declarationCount }"/></li>
                <li class="clean"></li>
            </ul>
        </s:if>
        <s:else>
            <ul class="ul1">
                <li class="li1 first_li">拖车业务代理人：</li>
                <li class="li1"><input class="custom_ipt" type="text" id="trial_sup_id"
                                       name="trial.supCompany.name" value="${trial.supCompany.name }"/><input
                        type="hidden" id="trial_sup" name="trial.supCompany.id"
                        value="${trial.supCompany.id }"/></li>
                <li class="li1 first_li" style="margin-left:10px;">PI号：</li>
                <li class="li1"><input class="custom_ipt"
                                       type="text" id="trial_pi" name="trial.pi"
                                       value="${trial.pi }" onblur="javascript:getPi(this.value);"/></li>
                <li class="li1 first_li" style="margin-left:10px;">报关票数登记：</li>
                <li class="li1"><input class="custom_ipt"
                                       type="text" id="trial_declarationCount" name="trial.declarationCount"
                                       value="${trial.declarationCount }"/></li>
                <li class="clean"></li>
            </ul>
        </s:else>
    </div>

    <div class="module">
        <div id="containersInfo">
            <span class="list_title">柜量信息：</span>
        </div>
        <div id="trailContainersInfo">
            <ul id="containers">
                <li class="li1">
			<span class='containerType'>
				<input type="text" id="ct_num" class="ct_num"/>
				<input type="text" id="ct_size" class="ct_size"/>
				<input type="text" id="ct_type" class="ct_type"/>
			</span>
                </li>
            </ul>
            <ul id="containerBtn">
                <li class="li1">
			<span>
				<input type="button" class="ui-button ui-widget ui-state-default ui-corner-all"
                       style="cursor: pointer;border-radius:3px" onclick="addCtTrailType();" value="添加柜型"/>
			</span>
                </li>
            </ul>
        </div>

        <div id="confirmContainerNum">
            <table style="width:10%;">
                <tr>
                    <td align="center">
                        <!-- 				<input type="button" class="ui-button ui-widget ui-state-default ui-corner-all" style="background-color: #fed14c;border:1px solid #f29a10 ;cursor: pointer;border-radius:3px" onclick="showTrailInfo();" value="确认柜量" /> -->
                        <input type="button" class="ui-button ui-widget ui-state-default ui-corner-all"
                               style="cursor: pointer;border-radius:3px" onclick="showTrailInfo();" value="确认柜量"/>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div id="trial_info_show" style="width:100%;">
        <s:if test="modelType=='1'.toString()">
            <div id="trail_info_shipmen" class="module">
                <div>
                    <span class="list_title">装运信息：</span>
                </div>
                <table id="trial_gd_input" style="width: 100%;margin-top: 10px">
                    <tr>
                        <td style="text-align: right;">SO号：</td>
                        <td><input type="text" id="gd_so" name="gd_so"
                                   value="<s:property value="trailModel.gdes[0].so" />"
                                   class="textInput validate[required]"/></td>
                    </tr>
                    <tr>
                        <td colspan="3"></td>
                    </tr>
                    <tr>
                        <td style="text-align: right;">货物名称：</td>
                        <td><input type="text" id="gd_name" name="gd_name"
                                   value="<s:property value="trailModel.gdes[0].name" />"
                                   class="textInput validate[required]"/></td>
                    </tr>

                    <tr style="white-space:nowrap;">
                        <td style="text-align: right;">装柜要求：</td>
                        <td colspan="4">
                            <input class="textInput" type="text" id="gd_remark"
                                   value="<s:property value="trailModel.gdes[0].remark" />" style="width: 350px"/>&nbsp;<font
                                color="red">有监装请注明</font>
                        </td>
                    </tr>
                    <tr style="height: 36px; border: 1px; margin-top:10px;">
                        <td class="labelTD fill_cell add_line custom_sw" style="width:80px;"></td>
                        <td class="labelTD fill_cell add_line custom_sw" style="width:100px;">装柜工厂名称</td>
                        <td colspan="2" class="labelTD fill_cell add_line custom_sw" style="width:380px;">装柜地址</td>
                        <td colspan="2" class="labelTD fill_cell add_line custom_sw" style="width:150px;">装柜时间</td>
                        <td class="labelTD fill_cell add_line custom_sw" style="width:50px;">联系人</td>
                        <td class="labelTD fill_cell add_line custom_sw" style="width:80px;">联系电话</td>
                        <td class="labelTD fill_cell add_line custom_sw" style="width:250px;">柜型</td>
                        <td class="labelTD fill_cell add_line custom_sw" style="text-align:center;display: none;">柜型统计
                        </td>
                        <td class="labelTD fill_cell add_line custom_sw" style="width:50px;">操作</td>
                    </tr>
                    <s:iterator value="trailModel.gdes" status="st">
                        <s:if test="#st.index == 0">
                            <tr style="white-space: nowrap;">
                                <td class="add_line" style="text-align: right;">地址1：</td>
                                <td class="add_line"><input type="text" id="gd_contacter_company"
                                                            value="${contacter.company }"
                                                            class="textInput validate[required] custom_wbf"/></td>
                                <td class="add_line" colspan="2" style="white-space:nowrap;">
                                    <input type="text" id="gd_contacter_city" size="8" value="${contacter.city }"
                                           placeholder="--市--" class="textInput validate[required]"
                                           onfocus="dropdown(this,'2')"/>
                                    <input type="text" id="gd_contacter_area" size="8" value="${contacter.area }"
                                           placeholder="--县(区)--" class="textInput validate[required]"
                                           onfocus="dropdown(this,'3')"/>
                                    <input type="text" id="gd_contacter_town" size="8" value="${contacter.town }"
                                           placeholder="--镇(街道)--" class="textInput validate[required]"
                                           onfocus="dropdown(this,'4')"/>
                                    <input type="text" id="gd_contacter_address_val" value="${contacter.address }"
                                           size="20" placeholder="--详细地址--" class="textInput validate[required]"/>
                                </td>
                                <td class="add_line" colspan="2" style="white-space:nowrap;">
                                    <input type="text" id="gd_zhDate"
                                           value="<s:date name="zhDate" format="yyyy-MM-dd" />"
                                           class="textInput validate[required]" onclick="zhDateInitialization(this);"/>
                                    <input type="text" id="gd_zhTime" value="<s:date name="zhDate" format="HH" />"
                                           class="textInput validate[required]" maxlength="2" size="2"/><font
                                        color="red">:00</font>
                                </td>
                                <td class="add_line"><input type="text" id="gd_contacter_name"
                                                            value="${contacter.name }"
                                                            class="textInput validate[required]"/></td>
                                <td class="add_line"><input class="textInput custom_wbf" type="text"
                                                            id="gd_contacter_phone" value="${contacter.phone }"/></td>
                                <td class="add_line"><input id="gd_ctNumType" value="${ctNumType }" type="text"
                                                            readonly="readonly"
                                                            class="ui-state-default ui-corner-all validate[required]"
                                                            style="width: 180px"/>&nbsp;&nbsp;全选:<input type="checkbox"
                                                                                                        id="selectall_checkbox"
                                                                                                        onclick="selectAll(this);"/>
                                </td>
                                <td class="add_line" style="display: none;"><span id="gd_ctNumType_show"><s:property
                                        value="ctNumType"/></span></td>
                                <td class="add_line" style="text-align: center;">
                                    <input type="hidden" id="gd_contacter_id" value="${contacter.id }"/>
                                    <input type="button"
                                           style="background-color: #94e7ff;border:1px solid #6acce8 ;cursor: pointer;border-radius:3px"
                                           value="增加" onclick="addTest();"/>
                                </td>
                            </tr>
                        </s:if>
                        <s:else>
                            <tr style="white-space: nowrap;" id="<s:property value="#st.index"/>">
                                <td class="add_line" style="text-align: right;">地址<s:property value="#st.index+1"/>：
                                </td>
                                <td class="add_line"><input type="text"
                                                            id="gd_contacter_company_<s:property value="#st.index"/>"
                                                            value="${contacter.company }"
                                                            class="textInput validate[required]"/></td>
                                <td class="add_line" colspan="2" style="white-space:nowrap;">
                                    <input type="text" id="gd_contacter_city_<s:property value="#st.index"/>"
                                           value="${contacter.city }" size="8" placeholder="--市--"
                                           class="textInput validate[required] custom_wbf"
                                           onfocus="dropdown(this,'2')"/>
                                    <input type="text" id="gd_contacter_area_<s:property value="#st.index"/>"
                                           value="${contacter.area }" size="8" placeholder="--县(区)--"
                                           class="textInput validate[required]" onfocus="dropdown(this,'3')"/>
                                    <input type="text" id="gd_contacter_town_<s:property value="#st.index"/>"
                                           value="${contacter.town }" size="8" placeholder="--镇(街道)--"
                                           class="textInput validate[required]" onfocus="dropdown(this,'4')"/>
                                    <input type="text" id="gd_contacter_address_val_<s:property value="#st.index"/>"
                                           value="${contacter.address }" size="20" placeholder="--详细地址--"
                                           class="textInput validate[required]"/>
                                </td>
                                <td class="add_line" colspan="2" style="white-space:nowrap;">
                                    <input type="text" id="gd_zhDate_<s:property value="#st.index"/>"
                                           value="<s:date name="zhDate" format="yyyy-MM-dd" />"
                                           class="textInput validate[required]" onclick="zhDateInitialization(this);"/>
                                    <input type="text" id="gd_zhTime_<s:property value="#st.index"/>"
                                           value="<s:date name="zhDate" format="HH" />"
                                           class="textInput validate[required]" maxlength="2" size="2"/><font
                                        color="red">:00</font>
                                </td>
                                <td class="add_line"><input type="text"
                                                            id="gd_contacter_name_<s:property value="#st.index"/>"
                                                            value="${contacter.name }"
                                                            class="textInput validate[required]"/></td>
                                <td class="add_line"><input class="textInput custom_wbf" type="text"
                                                            id="gd_contacter_phone_<s:property value="#st.index"/>"
                                                            value="${contacter.phone }"/></td>
                                <td class="add_line" style="white-space: nowrap;">
                                    <input id="gd_ctNumType_<s:property value="#st.index"/>" value="${ctNumType }"
                                           type="text" readonly="readonly"
                                           class="ui-state-default ui-corner-all validate[required]"
                                           style="width: 180px"/>&nbsp;&nbsp;全选:<input type="checkbox"
                                                                                       id="selectall_checkbox"
                                                                                       onclick="selectAll(this);"/>
                                </td>
                                <td class="add_line" style="display: none;"><span
                                        id="gd_ctNumType_show_<s:property value="#st.index"/>"><s:property
                                        value="ctNumType"/></span></td>
                                <td class="add_line" style="text-align: center;">
                                    <input type="hidden" id="gd_contacter_id_<s:property value="#st.index"/>"
                                           value="${contacter.id }"/>
                                    <input type="button"
                                           style="background-color: #94e7ff;border:1px solid #6acce8 ;cursor: pointer;border-radius:3px"
                                           value="删除" onclick="deleteTest('<s:property value="#st.index"/>');"/>
                                </td>
                            </tr>
                        </s:else>
                    </s:iterator>
                </table>
                <div id="confirmgoodesadBtn" align="center">
                    <input type="button" class="ui-button ui-widget ui-state-default ui-corner-all" value="确认货物"
                           onclick="confirmgoodesad();" style="padding:0.6em 0.8em;margin-top: 15px;"/>
                </div>
            </div>

            <table id="tril_goodsList_title">
                <tr>
                    <td class="first_li">货物列表：</td>
                    <td>柜总计&nbsp;&nbsp;</td>
                    <td><span id="totalSizeType"></span></td>
                    <td><input type="hidden" id="containerTotle" name="trial.containerTotle"
                               value="${trailModel.containerTotle }"></td>
                </tr>
            </table>
            <table class="dataTB dataTB_Individual trail_dataTB_Individual" id="tril_goodsList">
                <tr class="trhead" style="background-color:#dfe2f8;height:36px;">
                    <td class="titleTD trail_titleTD custom_sw" lang="name">货物名称</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="so">SO号</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="contacter_company">装柜工厂名称</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="id" style="display: none;">装柜工厂id</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="contacter_address_val">工厂地址</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="contacter_name">联系人</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="contacter_id" style="display: none;">联系人id</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="contacter_phone">联系电话</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="ctNumType" style="display: none;">柜型</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="ctNumTypeShow">柜型</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="zhDate" style="width: 150px;">建议装柜时间</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="remark">备注</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="ctNumTypeSo" style="display: none;">柜型与so</td>
                    <td class="titleTD trail_titleTD custom_sw">操作</td>
                    <td class="titleTD trail_titleTD custom_sw" style="display: none;">柜id</td>
                    <td class="titleTD trail_titleTD custom_sw" style="display: none;" lang="contacter_city"></td>
                    <td class="titleTD trail_titleTD custom_sw" style="display: none;" lang="contacter_area"></td>
                    <td class="titleTD trail_titleTD custom_sw" style="display: none;" lang="contacter_town"></td>
                    <td class="titleTD trail_titleTD custom_sw" style="display: none;" lang="contacter_address"></td>
                </tr>
                <s:if test="trail.id!=null && trail.id!=''">
                    <s:iterator value="trailModel.gdes">
                        <tr>
                            <td class="custom_bl"><s:property value="name"/></td>
                            <td class="custom_bl"><s:property value="so"/></td>
                            <td class="custom_bl"><s:property value="contacter.company"/></td>
                            <td class="custom_bl" style="display: none;"><s:property value="id"/></td>
                            <td class="custom_bl"><s:property value="contacter.city"/><s:property
                                    value="contacter.area"/><s:property value="contacter.town"/><s:property
                                    value="contacter.address"/></td>
                            <td class="custom_bl"><s:property value="contacter.name"/></td>
                            <td class="custom_bl" style="display: none;"><s:property value="contacter.id"/></td>
                            <td class="custom_bl"><s:property value="contacter.phone"/></td>
                            <td class="custom_bl" style="display: none;"><s:property value="ctNumType"/></td>
                            <td class="custom_bl"><s:property value="ctNumType.replaceAll(',','<br>')"
                                                              escape="false"/></td>
                            <td class="custom_bl"><s:date name="zhDate" format="yyyy-MM-dd HH:mm"/></td>
                            <td class="custom_bl"><s:property value="remark"/></td>
                            <td class="custom_bl" style="display: none;"><s:property value="ctNumType"/>+<s:property
                                    value="so"/></td>
                            <td class="custom_bl" style='width:200px;'><a
                                    onclick='editgoodesad($(this).parent().parent()[0])'
                                    style='cursor: pointer;color: blue;margin: 10px;'>修改</a>||<a
                                    onclick='delgoodes(this)' style='cursor: pointer;color: red;margin: 10px;'>删除</a>
                            </td>
                            <td class="custom_bl" class="" style="display: none;"></td>
                            <td class="custom_bl" style="display: none;"><s:property value="contacter.city"/></td>
                            <td class="custom_bl" style="display: none;"><s:property value="contacter.area"/></td>
                            <td class="custom_bl" style="display: none;"><s:property value="contacter.town"/></td>
                            <td class="custom_bl" style="display: none;"><s:property value="contacter.address"/></td>
                        </tr>
                    </s:iterator>
                </s:if>
            </table>
            <div id="new_tril_goodsList"></div>
        </s:if>
        <s:else>
            <div id="trail_info_shipmen" class="module">
                <div>
                    <span class="list_title">装运信息：</span>
                </div>
                <table id="trial_gd_input" style="width: 100%;margin-top: 10px">
                    <tr>
                        <td style="text-align: right;">SO号：</td>
                        <td><input type="text" id="gd_so" name="gd_so" value="<s:property value="trial.gdes[0].so" />"
                                   class="textInput validate[required]"/></td>
                    </tr>
                    <tr>
                        <td colspan="3"></td>
                    </tr>
                    <tr>
                        <td style="text-align: right;">货物名称：</td>
                        <td><input type="text" id="gd_name" name="gd_name"
                                   value="<s:property value="trial.gdes[0].name" />"
                                   class="textInput validate[required]"/></td>
                    </tr>

                    <tr style="white-space:nowrap;">
                        <td style="text-align: right;">装柜要求：</td>
                        <td colspan="4">
                            <input class="textInput" type="text" id="gd_remark"
                                   value="<s:property value="trial.gdes[0].remark" />" style="width: 350px"/>&nbsp;<font
                                color="red">有监装请注明</font>
                        </td>
                    </tr>
                    <tr style="height: 36px; border: 1px; margin-top:10px;">
                        <td class="labelTD fill_cell add_line custom_sw" style="width:80px;"></td>
                        <td class="labelTD fill_cell add_line custom_sw" style="width:100px;">装柜工厂名称</td>
                        <td colspan="2" class="labelTD fill_cell add_line custom_sw" style="width:380px;">装柜地址</td>
                        <td colspan="2" class="labelTD fill_cell add_line custom_sw" style="width:150px;">装柜时间</td>
                        <td class="labelTD fill_cell add_line custom_sw" style="width:50px;">联系人</td>
                        <td class="labelTD fill_cell add_line custom_sw" style="width:80px;">联系电话</td>
                        <td class="labelTD fill_cell add_line custom_sw" style="width:250px;">柜型</td>
                        <td class="labelTD fill_cell add_line custom_sw" style="text-align:center;display: none;">柜型统计
                        </td>
                        <td class="labelTD fill_cell add_line custom_sw" style="width:50px;">操作</td>
                    </tr>

                    <tr style="white-space: nowrap;">
                        <td class="add_line" style="text-align: right;">地址1：</td>
                        <td class="add_line"><input type="text" id="gd_contacter_company"
                                                    class="textInput validate[required] custom_wbf"/></td>
                        <td class="add_line" colspan="2" style="white-space:nowrap;">
                            <input style="width:50px;margin-left:5px;" type="text" id="gd_contacter_city"
                                   placeholder="--市--" class="textInput validate[required]"
                                   onfocus="dropdown(this,'2')"/>
                            <input style="width:50px;" type="text" id="gd_contacter_area" placeholder="--县(区)--"
                                   class="textInput validate[required]" onfocus="dropdown(this,'3')"/>
                            <input style="width:100px;" type="text" id="gd_contacter_town" placeholder="--镇(街道)--"
                                   class="textInput validate[required]" onfocus="dropdown(this,'4')"/>
                            <input style="width:150px;" type="text" id="gd_contacter_address_val" placeholder="--详细地址--"
                                   class="textInput validate[required]"/>
                        </td>
                        <td class="add_line" colspan="2" style="white-space:nowrap;">
                            <input type="text" id="gd_zhDate" class="textInput validate[required]"
                                   style="width:80px;margin-left:5px;" onclick="zhDateInitialization(this);"/>
                            <input type="text" id="gd_zhTime" class="textInput validate[required]" maxlength="2"
                                   style="width:30px"/><font color="red">:00</font>
                        </td>
                        <td class="add_line"><input type="text" id="gd_contacter_name" style="width: 70px;"
                                                    class="textInput validate[required] custom_wbf"/></td>
                        <td class="add_line"><input class="textInput custom_wbf" type="text" id="gd_contacter_phone"
                                                    style="width: 90px;"/></td>
                        <td class="add_line" style="white-space: nowrap;"><input id="gd_ctNumType" type="text"
                                                                                 readonly="readonly"
                                                                                 class="ui-state-default ui-corner-all validate[required] custom_wbf"
                                                                                 style="width: 180px;"/>&nbsp;&nbsp;全选:<input
                                type="checkbox" id="selectall_checkbox" onclick="selectAll(this);"/></td>
                        <td class="add_line" style="display: none;"><span id="gd_ctNumType_show"><s:property
                                value="ctNumType"/></span></td>
                        <td class="add_line" style="text-align: center;">
                            <input type="hidden" id="gd_contacter_id"/>
                            <input type="button"
                                   style="background-color: #94e7ff;border:1px solid #6acce8 ;cursor: pointer;border-radius:3px"
                                   value="增加" onclick="addTest();"/>
                        </td>
                    </tr>
                </table>
                <div id="confirmgoodesadBtn" align="center">
                    <input type="button" class="ui-button ui-widget ui-state-default ui-corner-all" value="确认货物"
                           onclick="confirmgoodesad();" style="padding:0.6em 0.8em;margin-top: 15px;"/>
                </div>

            </div>

            <table id="tril_goodsList_title">
                <tr>
                    <td class="first_li">货物列表：</td>
                    <td>柜总计&nbsp;&nbsp;</td>
                    <td><span id="totalSizeType"></span></td>
                    <td><input type="hidden" id="containerTotle" name="trial.containerTotle"
                               value="${trial.containerTotle }"></td>
                </tr>
            </table>
            <table class="dataTB dataTB_Individual trail_dataTB_Individual" id="tril_goodsList">
                <tr class="trhead" style="background-color:#dfe2f8;height:36px;">
                    <td class="titleTD trail_titleTD custom_sw" lang="name">货物名称</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="so">SO号</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="contacter_company">装柜工厂名称</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="id" style="display: none;">装柜工厂id</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="contacter_address_val">工厂地址</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="contacter_name">联系人</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="contacter_id" style="display: none;">联系人id</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="contacter_phone">联系电话</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="ctNumType" style="display: none;">柜型</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="ctNumTypeShow">柜型</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="zhDate" style="width: 150px;">建议装柜时间</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="remark">备注</td>
                    <td class="titleTD trail_titleTD custom_sw" lang="ctNumTypeSo" style="display: none;">柜型与so</td>
                    <td class="titleTD trail_titleTD custom_sw">操作</td>
                    <td class="titleTD trail_titleTD custom_sw" style="display: none;">柜id</td>
                    <td class="titleTD trail_titleTD custom_sw" style="display: none;" lang="contacter_city"></td>
                    <td class="titleTD trail_titleTD custom_sw" style="display: none;" lang="contacter_area"></td>
                    <td class="titleTD trail_titleTD custom_sw" style="display: none;" lang="contacter_town"></td>
                    <td class="titleTD trail_titleTD custom_sw" style="display: none;" lang="contacter_address"></td>
                </tr>
                <s:if test="trial.id!=null && trial.id!=''">
                    <s:iterator value="trial.gdes">
                        <tr>
                            <td class="custom_bl"><s:property value="name"/></td>
                            <td class="custom_bl"><s:property value="so"/></td>
                            <td class="custom_bl"><s:property value="contacter.company"/></td>
                            <td class="custom_bl" style="display: none;"><s:property value="id"/></td>
                            <td class="custom_bl"><s:property value="contacter.city"/><s:property
                                    value="contacter.area"/><s:property value="contacter.town"/><s:property
                                    value="contacter.address"/></td>
                            <td class="custom_bl"><s:property value="contacter.name"/></td>
                            <td class="custom_bl" style="display: none;"><s:property value="contacter.id"/></td>
                            <td class="custom_bl"><s:property value="contacter.phone"/></td>
                            <td class="custom_bl" style="display: none;"><s:property value="ctNumType"/></td>
                            <td class="custom_bl"><s:property value="ctNumType.replaceAll(',','<br>')"
                                                              escape="false"/></td>
                            <td class="custom_bl"><s:date name="zhDate" format="yyyy-MM-dd HH:mm"/></td>
                            <td class="custom_bl"><s:property value="remark"/></td>
                            <td class="custom_bl" style="display: none;"><s:property value="ctNumType"/>+<s:property
                                    value="so"/></td>
                            <td class="custom_bl" style='width:200px;'><a
                                    onclick='editgoodesad($(this).parent().parent()[0])'
                                    style='cursor: pointer;color: blue;margin: 10px;'>修改</a>||<a
                                    onclick='delgoodes(this)' style='cursor: pointer;color: red;margin: 10px;'>删除</a>
                            </td>
                            <td class="custom_bl" class="" style="display: none;"></td>
                            <td class="custom_bl" style="display: none;"><s:property value="contacter.city"/></td>
                            <td class="custom_bl" style="display: none;"><s:property value="contacter.area"/></td>
                            <td class="custom_bl" style="display: none;"><s:property value="contacter.town"/></td>
                            <td class="custom_bl" style="display: none;"><s:property value="contacter.address"/></td>
                        </tr>
                    </s:iterator>
                </s:if>
            </table>
            <div id="new_tril_goodsList"></div>
        </s:else>

        <div id="so">
            <table>
                <tr>
                    <td class="first_li">上传SO文件和放柜通知：</td>
                    <td><font color="red">（注：请将SO文件和放柜通知打包上传，并将压缩包的大小控制在5M以内!）</font></td>
                </tr>
            </table>
            <table>
                <tr>
                    <td><s:if test="trial.soDoc!=null"><s:property value="trial.soDoc.name"/><input type="button"
                                                                                                    value="删除附件"
                                                                                                    onclick="cancleUpload();"/></s:if><s:else>上传</s:else>
                    </td>
                    <td><input id="button_so" type="button"
                               style="background-color: #94e7ff;border:1px solid #6acce8 ;cursor: pointer;border-radius:3px"
                               value="选择文件" onclick="upload();"/></td>
                </tr>
            </table>
        </div>
        <div id="upload_so" style="display: none;">
            SO信息：<span id="soValue"></span><input name="trial.soDoc.id" value="<s:property value="trial.soDoc.id" />"
                                                  id="soid" style="display:none;"/>
        </div>
        <div id="dialog001" style="display:none">
            <s:form id="uploadForm" action="attach-upload" enctype="multipart/form-data" method="POST">
                <s:file label="选择文件" name="attach"></s:file>
                <s:submit value="上传"></s:submit>
            </s:form>
        </div>
    </div>
</div>
